package com.zhongtengxin.zhanzhao.utils.network.converter

import com.google.gson.Gson
import com.google.gson.TypeAdapter
import okhttp3.ResponseBody
import retrofit2.Converter
import java.io.IOException

/**
 * Created by admin Mr.WANG 2017/11/27.
 */
internal class GsonResponseBodyConverter<T>(private val gson: Gson, private val adapter: TypeAdapter<T>) : Converter<ResponseBody, T> {

    @Throws(IOException::class)
    override fun convert(value: ResponseBody): T? {
        val reponseData = value.string()

        return adapter.fromJson(reponseData)


    }
}